<%  @inproducts_group.keys.sort.reverse.each do |group| %>  
  <tr>

    <td colspan="10" style="text-align:left;font-size: 1.5em;color: #AAA;background :#FFFFFF url(/images/bg_sidebar.png) repeat-x scroll left bottom;padding-left: 15px;">
    <%= group.strftime('%Y-%m-%d') %></td>

  </tr>

  <%  for ip in  @inproducts_group[group] %>

    <tr>

      <td>
        <%# 需要确保此商品存在，未被删除 %>
        <% if ip.product %>
          <%= ip.product.category.name  %></td>
        <td style="text-align: left;" title="<%= ip.product.cn_name %>"><%= truncate(ip.product.cn_name, :length =>40) %></td>
        <td style="text-align: left;" title="<%= ip.product.en_name %>"><%= truncate(ip.product.en_name, :length =>40) %></td>

        <td><%= ip.price %></td>
        <td><%= ip.amount.abs %></td>
        <td><%=h ip.total_price.abs %></td>
        <td title="<%= ip.order_num %>"><%= truncate(ip.order_num,:length =>10) %></td>
        <td title="<%= ip.description %>"><%= truncate(ip.description,:length =>10) %>
		<% if ip.f_store_id != 4 %><b><%= "来自库房:#{ip.f_store_id}" %></b><% end  %>
		</td>
        <!-- <td>

      <%#= link_to "编辑",edit_inproduct_path(ip) %></td>  -->
        <td><%= link_to image_tag("/images/edit2.png",:width => 16,:height => 16,:alt => "Edit?",:title => "Edit?"), edit_inproduct_path(ip,:f_store_id => params[:f_store_id]) %></td>
        <td><%= link_to image_tag("/images/delete.gif",:alt => "Delete?",:title => "Delete?"), {:controller =>"inproducts" ,:action => :destroy,:id => ip,:f_store_id => params[:f_store_id]},:confirm => "Are you sure you want to delete?",:method => :delete %></td>
      </tr>

    <% end %>
  <% end %>
  <tr style="background:#EFEFEF;"><td colspan="6" style="text-align:right;padding-right: 10px;">
          总计:<b><%= @inproducts_group[group].collect{|g| g.total_price}.sum %></b>
    </td><td colspan="4"></td>
  </tr>
<% end %>


